import Vue from 'vue'
import Router from 'vue-router'

const Home = () => import('@/components/pages/home/index')
const Huawei = () => import('@/components/pages/home/huawei')
const Category = () => import('@/components/pages/category/index')
const Find = () => import('@/components/pages/find/index')
const Cart = () => import('@/components/pages/cart/index')
const Personal = () => import('@/components/pages/personal/index')
const Detail = () => import('@/components/pages/detail/index')
const Scop = () => import('@/components/pages/scop/index')

Vue.use(Router)

export default new Router({
  mode:'history',
  routes: [
    {
      path: '',
      redirect: '/home'
    },
    {
      path: '/home',
      name: '首页',
      component: Home
    },
    {
      path: '/category',
      name: '分类',
      component: Category
    },
    {
      path: '/find',
      name: '发现',
      component: Find
    },
    {
      path: '/cart',
      name: '购物车',
      component: Cart
    },
    {
      path: '/personal',
      name: '我的',
      component: Personal
    },
    {
      path: '/huawei',
      name: '华为专区',
      component: Huawei,
    },
    {
      path: '/detail',
      name: '详情',
      component: Detail
    },
    {
      path: '/scop',
      name: '示波器',
      component: Scop
    },
  ],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})
